package com.chixing.day04_oop;

public class AccountTest {
    public static void main(String[] args) {

        SavingAccount sa = new SavingAccount();
        sa.depoist(100);//从父类继承的方法
        sa.withdraw(20);

        CreditAccount ca = new CreditAccount();
        ca.depoist(100);//从父类继承的方法
        ca.withdraw(20);

        sa.setAccNo(1001);
        sa.setAccName("hh");
        sa.setAccBalance(555);
        sa.setAccTelno(17744622533L);

        System.out.println(sa);
        System.out.println(sa.toString());

        SavingAccount sa1 = new SavingAccount();
        SavingAccount sa2 = sa1;
        //判断 s2 是不是SavingAccount 类型
        boolean result = sa2 instanceof SavingAccount;  //d看堆中的对象值的类型

        //父类类型 = new 子类对象()
        //父类引用子类对象
        Account acc = new SavingAccount();
        System.out.println(acc instanceof Account);
        System.out.println(acc instanceof SavingAccount);

        CreditAccount acc3 =(CreditAccount) acc;
        acc3.setAccBalance(5555);
        System.out.println(acc3.getAccBalance());




    }
}
